/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commonInfrastructure.accountManagement.session;

import commonInfrastructure.accountManagement.entity.WarehousePersonnelEntity;
import java.util.List;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.Query;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author GKnight
 */
@Stateless
@LocalBean
public class WarehousePersonnelSessionBean {

    @PersistenceContext
    private EntityManager em;
    
    public void addWarehousePersonnel(WarehousePersonnelEntity warehouseman){
        em.persist(warehouseman);
    }
    
    public void saveChanges(WarehousePersonnelEntity warehouseman){
        em.merge(warehouseman);
    }
    
    public List<WarehousePersonnelEntity> getAllWarehousePersonnel(){
        Query query = em.createQuery("SELECT w FROM WarehousePersonnelEntity w");
        return query.getResultList();
    }
    
    public WarehousePersonnelEntity getWarehousemanById(Long id){
        return em.find(WarehousePersonnelEntity.class, id);
    }
    
}
